package com.sh.data.engine.domain.integration.offline.model.domain;

import com.sh.data.engine.domain.base.model.BaseDomain;
import lombok.Data;
import lombok.experimental.SuperBuilder;
import lombok.experimental.Tolerate;

import java.util.Date;

@Data
@SuperBuilder
public class OfflineSyncRunningRecordDomain extends BaseDomain {

    //    private Long id;
    private Long offlineSyncId;
    private Integer executeType; // 手动 自动
    private Integer taskStatus;
    private Date startTime;
    private Date endTime; // 执行日志id
    private Date planTime;
    private String sourceTable;
    private String targetTable;

    private Long duration;
    private String creator;
    private String taskName;
    private String ipAddress;
//    private String creatorId;
//    private String updaterId;

    private Long projectId;
    private Integer ignored;

    //  private List<OfflineSyncSubRunningRecord> subRecords;

  /*@Data
  @Builder(toBuilder = true)
  public static class OfflineSyncSubRunningRecord {

    //    private Integer executeType;
    private String id;
    private Integer taskStatus;
    private Date startTime;
    private Date endTime;
    private String sourceTable;
    private String targetTable;

    @Tolerate
    public OfflineSyncSubRunningRecord() {}
  }*/

    @Tolerate
    public OfflineSyncRunningRecordDomain() {
    }

  /*public static OfflineSyncRunningRecordEntity domain2Entity(
      OfflineSyncRunningRecordDomain source) {
    OfflineSyncRunningRecordEntity target =
        ConvertUtil.copyProperties(source, OfflineSyncRunningRecordEntity.class);
    List<OfflineSyncSubRunningRecord> subRecords = source.getSubRecords();
    if(CollectionUtils.isNotEmpty(subRecords)){
      List<OfflineSyncRunningRecordEntity.OfflineSyncSubRunningRecord> offlineSyncSubRunningRecords =
              ConvertUtil.copyProperties(
                      subRecords, OfflineSyncRunningRecordEntity.OfflineSyncSubRunningRecord.class);
      target.setSubRecords(offlineSyncSubRunningRecords);
    }
    return target;
  }*/

  /*public static OfflineSyncRunningRecordDomain entity2Domain(
      OfflineSyncRunningRecordEntity source) {
    OfflineSyncRunningRecordDomain target =
        ConvertUtil.copyProperties(source, OfflineSyncRunningRecordDomain.class);
    List<OfflineSyncRunningRecordEntity.OfflineSyncSubRunningRecord> subRecords =
        source.getSubRecords();
    List<OfflineSyncSubRunningRecord> offlineSyncSubRunningRecords =
        ConvertUtil.copyProperties(subRecords, OfflineSyncSubRunningRecord.class);
    target.setSubRecords(offlineSyncSubRunningRecords);
    return target;
  }*/
}
